/* Layout */
import Layout from '@/layout'
export const constantRoutes = [
  {
    path: '/redirect',
    component: Layout,
    hidden: true,
    children: [
      {
        path: '/redirect/:path(.*)',
        component: () => import('@/views/redirect/index')
      }
    ]
  },
  {
    path: '/login',
    component: () => import('@/views/login/index')
  },
  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    children: [{
      path: 'dashboard',
      name: 'Dashboard',
      component: () => import('@/views/dashboard/index'),
      // meta: { title: '首页', icon: 'HomeFilled' }
      meta: { title: '首页', icon: 'HomeFilled' }
    }]
  },
  {
    path: '/content',
    component: Layout,
    redirect: '/content/category',
    meta: { title: '内容管理', icon: 'Apple' },
    children: [{
      path: 'category',
      name: 'Category',
      component: () => import('@/views/content/category'),
      meta: { title: '文章分类', icon: '' }
    }, {
      path: 'article',
      name: 'Article',
      component: () => import('@/views/content/article'),
      meta: { title: '文章管理', icon: '' }
    }]
  },
  // 404 page must be placed at the end !!!
  // { path: '/:pathMatch(.*)*', name: 'NotFound', component: () => import('@/views/common/404') },
]

/**
 * 权限路由 暂时不用, 结合后端
 * asyncRoutes
 * the routes that need to be dynamically loaded based on user roles
 */
export const asyncRoutes = [
  {
    path: '/permission',
    component: Layout,
    redirect: '/permission/page',
    alwaysShow: true, // will always show the root menu
    name: 'Permission',
    meta: {
      title: 'Permission',
      icon: 'lock',
      roles: ['admin', 'editor'] // you can set roles in root nav
    },
    children: [
      {
        path: 'page',
        component: () => import('@/views/dashboard/index'),
        name: 'PagePermission',
        meta: {
          title: 'Page Permission',
          roles: ['admin'] // or you can only set roles in sub nav
        }
      },
      {
        path: 'directive',
        component: () => import('@/views/dashboard/index'),
        name: 'DirectivePermission',
        meta: {
          title: 'Directive Permission'
          // if do not set roles, means: this page does not require permission
        }
      },
      {
        path: 'role',
        component: () => import('@/views/dashboard/index'),
        name: 'RolePermission',
        meta: {
          title: 'Role Permission',
          roles: ['admin']
        }
      }
    ]
  },
  // 404 page must be placed at the end !!!
  { path: '*', redirect: '/404', hidden: true }
]
